import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import {StatusBar} from "@ionic-native/status-bar";

/**
 * Generated class for the VideoPage page.
 *
 * See http://ionicframework.com/docs/components/#navigation for more info
 * on Ionic pages and navigation.
 */
@IonicPage()
@Component({
  selector: 'page-video',
  templateUrl: 'video.html',
})
export class VideoPage {

    lesson_detail: any;
    videoWidget: any;
    hor_size: number = 412;
    ver_size: number = 412;
    isHorizon: boolean = true;

    constructor(public navCtrl: NavController, public navParams: NavParams, private statusBar: StatusBar) {
        this.lesson_detail = this.navParams.get('data');
        console.log(this.lesson_detail);

        if (this.isHorizon) {
            this.hor_size = screen.height;
            this.ver_size = screen.width;
        } else {
            this.hor_size = screen.width;
            this.ver_size = screen.height;
        }
    }

    ionViewDidLoad() {

    }

    ionViewWillEnter() {
        if (this.statusBar.isVisible) {
            this.statusBar.hide();
        }
        this.videoWidget = document.getElementById('lesson_video');
        this.videoWidget.controls = true;
    }

    ionViewDidEnter() {

    }

    ionViewDidLeave() {
        if (!this.statusBar.isVisible) {
            this.statusBar.show();
        }
    }

    onBack() {
        this.navCtrl.pop();
    }

    getBaseStyle(isHorScreen) {
        return {
            'ver-rotate': !isHorScreen,
            'hor-rotate': isHorScreen
        };
    }
}
